<%@page import="javax.naming.Context"%>
<%@page import="javax.naming.InitialContext"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login,jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
   <%
  request.setCharacterEncoding("utf-8");
  response.setContentType("text/html;charset=utf-8");
  %>
  <%
  //javax.naming.Context提供了查找JNDI 的接口
Context ctx = new InitialContext();	
//java:comp/env/为前缀
String testjndi = (String)ctx.lookup("java:comp/env/tjndi");
out.println("JNDI: "+testjndi);
%>
  <h1>登陆页</h1><%=session.getAttribute("err")==null?"":session.getAttribute("err")%>
    
    <form action="LoginServlet" method="post">
    	ID：<input type="text" name="id"/><br/>
    	pwd：<input type="password" name="pwd"/><br/>
    		<input type="submit" value="登陆"/>
    </form>
  </body>
  </body>
</html>
